<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{asset('/css/web/user/shop_brand.css')}}">
    <link rel="stylesheet" href="{{asset('/css/web/user/contract_msg.css')}}">
    <link rel="stylesheet" href="{{asset('/css/web/user/contract.css')}}">
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.seller_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title" style="border-bottom:0;">合同信息</div>
                <div class="content">
                    <div class="contract_top">
                        <ul>
                            <li class="first">1、签署合同</li>
                            <li>2、确认结算</li>
                        </ul>
                    </div>
                    <form action="" id="contracts_info" method="post">
                            <div class="contract_title">
                                资质合同
                            </div>
                            <div class="contract_con">
                                @if(isset($type) && $type == 'put')
                                    {{method_field("PUT")}}
                                @endif
                                {!!  csrf_field() !!}
                                <input type="hidden" name="id" value="{{old('id')}}" />
                                <input type="hidden" value="{{$qid}}" name="{{old('qid')}}" />
                                <div class="contract_id_time">
                                    <div class="contract_id fl contract_people">合同编号：
                                        <span>
                                           {{old("contract_code")}}
                                        </span>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                                <div class="contract_people">甲方：{{old('buyer_name')}} </div>
                                <div class="contract_people">乙方：{{old('seller_name')}}</div>
                                <div class="contract_word">根据《中华人民共和国合同法》及相关法律法规的规定，甲乙双方在平等、自愿、公平、协商一致的基础上，就甲方委托乙方提供服务的有关事宜达成如下协议：</div>
                        
                                <div class="contract_word">合同条例：</div>

                                <div class="contract_prompt">
                                    {!! old("contract_content") !!}
                                </div>
                                <div class="contract_st_box">
                                    <div class="contract_seal_box fl">
                                        <div class="seal_people">甲方：<span>{{old('buyer_name')}}</span></div>
                                        <div class="seal">（盖章）</div>
                                    </div>
                                    <div class="contract_seal_box fr">
                                        <div class="seal_people">乙方：<span>{{old('seller_name')}}</span></div>
                                        <div class="seal">（盖章）</div>
                                    </div>
                                </div>
                            </div>
                            <div class="btn_box">
                                <div class="btn_confirm" type="submit" data-id='{{old('id')}}'>合同签署</div>
                            </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

@include('web.layout.footer')
<script>
  $(function() {
        $('.btn_confirm').click(function(){
        var confirm_id = $(this).attr('data-id');
        layer.confirm('是否签署合同？', {
            btn: ['确认', '取消'] //可以无限个按钮
        }, function (index) {
            $.ajax({
                url: "/member/buyer/order_contract/contract_post",
                type: 'post',
                dataType: 'json',
                data: {'id': confirm_id,'qid':"{{old('qid')}}"},
                success: function (data) {
                    if (1 == data.status) {
                        layer.alert("签署成功", {
                            icon: 1
                        }, function () {
                            location.href='/member/buyer/order_contract/contract_cost?order_id='+data.order_id+"&seller_id="+data.seller_id;
                        });
                    } else {
                        layer.alert(data.msg, {
                            icon: 2
                        });
                    }
                }
            });
        }, function (index, layero) {
            layer.close(index);
        });
    });
  })  
</script>
</body>
</html>